PATINA algorithm